package sgbag1.Vues;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.Stroke;
import java.awt.geom.Point2D;


public class VueElement extends Vue {
    
    protected Color selectableColor = new Color(0, 255, 255);//aqua
    protected Color selectedColor = new Color(0, 0, 139);//blue4
    protected EtatElement etat = EtatElement.NORMAL;
    
    public VueElement(){
        this(new Point (0, 0));
    }
    
    public VueElement(Point p){
        super(p);
    }
    
    public void ChangerEtat(EtatElement e){
        etat = e;
    }
    
    public EtatElement RecupererEtat(){
        return etat;
    }
    
    @Override
    public void CalculerBoiteEnglobante() {
    }
    
    @Override
    public void Dessiner(Graphics g){
        Graphics2D g2 = (Graphics2D)g;
        if(etat == EtatElement.SELECTED){
            Color tempColor = g2.getColor();
            Stroke tempStroke = g2.getStroke();
            float dash[] = { 2.0f };
            
            g2.setColor(new Color(0, 0, 0));
            g2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, dash, 0.0f));
            //g2.drawRect(((Polygon)boiteEnglobante).get, ((Rectangle)boiteEnglobante).y, (int)((Rectangle)boiteEnglobante).getWidth(), (int)((Rectangle)boiteEnglobante).getHeight());
            g2.draw(boiteEnglobante);
            g2.setColor(tempColor);
            g2.setStroke(tempStroke);
        }

    }
}
